package com.molichuxing.services.infrastructure.service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

import com.molichuxing.framework.dto.Paged;
import com.molichuxing.framework.service.RootService;
import com.molichuxing.services.infrastructure.dto.request.create.CheckCreateDto;
import com.molichuxing.services.infrastructure.dto.request.modify.CarCheckModifyDto;
import com.molichuxing.services.infrastructure.dto.request.modify.PdiCheckModifyDto;
import com.molichuxing.services.infrastructure.dto.response.CheckDto;
import com.molichuxing.services.property.CarCheckStatusEnum;
import com.molichuxing.services.property.CarsTypeEnum;

/**
 * <p>
 * 车辆检验表 服务类
 * </p>
 *
 * @author
 * @since 2019-08-15
 */
public interface CheckService extends RootService {

	/***
	 * 获取检验车辆id集合
	 * 
	 * @param carId
	 *            车辆id
	 * @param carsTypeEnum
	 *            车辆类型
	 * @param carCheckStatusEnum
	 *            车辆检验状态
	 * @param startCheckTime
	 * @param endCheckTime
	 * @param pageSize
	 * @param pageNum
	 * @return
	 */
	Paged<CheckDto> getCarsCheckListPage(List<Integer> carId, CarsTypeEnum carsTypeEnum,
			CarCheckStatusEnum carCheckStatusEnum, LocalDateTime startCheckTime, LocalDateTime endCheckTime,
			Integer pageSize, Integer pageNum);

	/**
	 * 根据车辆id获取检验信息
	 * 
	 * @param carId
	 * @return
	 */
	List<CheckDto> getCheckByCarId(Integer carId);

	/**
	 * 根据订单号获取检验信息
	 * 
	 * @param orderCode
	 * @return
	 */
	List<CheckDto> getCheckByOrderCode(Long orderCode);

	/***
	 * 根据检验id 获取检验信息
	 * 
	 * @param id
	 * @return
	 */
	CheckDto getById(Integer id);

	/***
	 * 根据检验id 修改检验信息
	 * 
	 * @param id
	 * @param facadeStatus
	 * @param remark
	 * @return
	 */
	int modifyCheckDto(Integer id, Integer facadeStatus, String remark, Integer carType,
			CarCheckModifyDto carCheckModifyDto);

	int pdiModifyCheckDto(PdiCheckModifyDto pdiCheckModifyDto);

	/***
	 * PDI 车辆检验列表
	 * 
	 * @param carId
	 * @param carCheckStatusEnum
	 * @param pageSize
	 * @param pageNum
	 * @return
	 */
	Paged<CheckDto> getPdiCarsCheckListPage(List<Integer> carId, Long orderCode, Integer returnStoreId,
			CarCheckStatusEnum carCheckStatusEnum, Integer dealerId, Integer pageSize, Integer pageNum);

	/**
	 * 根据状态获取数量
	 * 
	 * @return
	 * @throws Exception
	 */
	public Map<Integer, Integer> getCheckCountByStatus(Integer type, Integer dealerId) throws Exception;

	/**
	 * 全部数量
	 * 
	 * @return
	 */
	public Integer getCount(Integer type, Integer dealerId);

	/**
	 *  检验待处理数量
	 * @param type
	 * @return
	 */
	public Integer getPendCount(Integer type);

	/**
	 *修改检验状态
	 *
	 * @return
	 * @throws Exception
	 */
	public Boolean modifyCheckStatus(Integer id,Integer status)throws Exception;

	/**
	 *修改检验状态
	 *
	 * @return
	 * @throws Exception
	 */
	public Boolean modifyCheckStatusAndOpName(Integer id,Integer status, String opName)throws Exception;

	/**
	 * 车辆检验新增
	 * 
	 * @param createDto
	 * @return
	 */
	public Boolean create(CheckCreateDto createDto);

	/**
	 * 查询
	 * 
	 * @param orderCodes
	 *            订单号
	 * @return
	 */
	public Map<Long, CheckDto> getCheck(List<Long> orderCodes);
}
